package com.xxx.borrow.model.http;

import com.xxx.borrow.ConfigClass;
import com.xxx.borrow.model.http.bean.AppVersionBean;
import com.xxx.borrow.model.http.bean.LoginBean;
import com.xxx.borrow.model.http.bean.UserInfo;
import com.xxx.borrow.model.http.bean.base.BaseBean;
import com.xxx.borrow.model.http.bean.base.BooleanBean;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;

public interface ApiService {


    //提现
    @POST(ConfigClass.BASE_URL_PATH + "/doChange")
    @FormUrlEncoded
    Observable<BaseBean<BooleanBean>> withdrawal(
            @Field("coinId") int coinId,
            @Field("amount") double amount,
            @Field("fee") double fee,
            @Field("code") int code,
            @Field("address") String address,
            @Field("jyPassword") String jyPassword,
            @Field("remark") String remark
    );


    //-------------------------------------------------------登录-------------------------------------------------------------------------------------------------------------------------------//


    //登录
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/login")
    Observable<BaseBean<LoginBean>> login(
            @Field("phone") String account,
            @Field("password") String password,
            @Field("area") String area
    );

    //发送短信验证码
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/sendPhoneMassage")
    Observable<BaseBean<BooleanBean>> sendSMSCode(
            @Field("phone") String phone,
            @Field("area") String area
    );

    //发送修改密码验证码
    @POST(ConfigClass.BASE_URL_PATH + "/sendUpdatePhoneMassage")
    Observable<BaseBean<BooleanBean>> sendUpdateSMSCode();

    //注册
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/register")
    Observable<BaseBean<BooleanBean>> register(
            @Field("phone") String phone,
            @Field("password") String password,
            @Field("code") String smsCode,
            @Field("area") String area
    );

    //忘记密码
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/forgetPassword")
    Observable<BaseBean<BooleanBean>> forgetPsw(
            @Field("phone") String phone,
            @Field("newPassword") String newPassword,
            @Field("code") String smsCode
    );

    //修改登录密码
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/updatePassword")
    Observable<BaseBean<BooleanBean>> modifyLoginPsw(
            @Field("oldPassword") String password,
            @Field("newPassword") String mode,
            @Field("code") String smsCode
    );

    //修改支付密码
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/updatePayPassword")
    Observable<BaseBean<BooleanBean>> modifyPayPsw(
            @Field("payPassword") String password,
            @Field("code") String smsCode
    );

    //设置支付密码
    @FormUrlEncoded
    @POST(ConfigClass.BASE_URL_PATH + "/setPayPassword")
    Observable<BaseBean<BooleanBean>> settingPayPsw(
            @Field("payPassword") String payPassword
    );


    //检查app版本
    @GET(ConfigClass.BASE_URL_PATH + "/checkUpdate")
    Observable<BaseBean<AppVersionBean>> checkAppVersion();

    //退出登录
    @POST(ConfigClass.BASE_URL_PATH + "/loginOut")
    Observable<BaseBean<Object>> outLogin();

    //意见反馈
    @POST(ConfigClass.BASE_URL_PATH + "/loginOut")
    @FormUrlEncoded
    Observable<BaseBean<Object>> submitFeedback(
            @Field("content") String amount,
            @Field("phone") String address
    );

    //获取用户信息
    @POST(ConfigClass.BASE_URL_PATH + "/getUser")
    Observable<BaseBean<UserInfo>> getUserinfo();


}